#include "connectreplymsg.h"

CConnectReplyMsg::CConnectReplyMsg()
		: CNetMsg(CNetMsg::MSG_TYPE_CONNECT_REPLY)
{
}

void CConnectReplyMsg::setConnectionAccepted(bool bAccept)
{
	m_bAccepted = bAccept;
}

bool CConnectReplyMsg::getConnectionAccepted() const
{
	return m_bAccepted;
}


void CConnectReplyMsg::setConnectionErrorString(const QString strError)
{
	m_strError = strError;
}

QString CConnectReplyMsg::getConnectionErrorString() const
{
	return m_strError;
}


void CConnectReplyMsg::setConfigPayload(const QString &strConfigXML)
{
	m_strConfig = strConfigXML;
}

QString CConnectReplyMsg::getConfigPayload() const
{
	return m_strConfig;
}

void CConnectReplyMsg::serialiseToStream(QDataStream &s) const
{
	s << m_bAccepted;
	if (m_bAccepted)
	{
		s << m_strConfig;
	}
	else
	{
		s << m_strError;
	}
}

void CConnectReplyMsg::serialiseFromStream(QDataStream &s)
{
	s >> m_bAccepted;
	if (m_bAccepted)
	{
		s >> m_strConfig;
	}
	else
	{
		s >> m_strError;
	}
}
